<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="/static/kindeditor/themes/default/default.css" />
		<script charset="utf-8" src="/static/kindeditor/kindeditor-all.js"></script>
		<script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
		<script src="/bck/static/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="/static/webuploader/webuploader.css">
		<script type="text/javascript" src="/static/webuploader/webuploader.js"></script>
		<style type="text/css">
			#tj {
				position: fixed;
				top: 0px;
				left: 0px;
				width: 1920px;
				height: 910px;
				background: rgba(0, 0, 0, 0.3);
				color: #666;
			}
			
			#tj_1 {
				position: fixed;
				width: 732px;
				height: 882px;
				top: 23.5px;
				left: 750px;
				background: white;
			}
			
			#tj_1_1 {
				/*width: 100%;*/
				height: 50px;
				line-height: 50px;
				border: 0;
				background-color: #20222A;
				color: #fff;
				padding: 0 0px 0 20px;
			}
			
			#tj_1_2 {
				width: 420px;
				height: 710px;
				padding-left: 75px;
				padding-top: 24px;
			}
			
			#tjbtn {
				width: 64px;
				height: 38px;
				line-height: 38px;
				padding: 0 18px;
				background-color: #009688;
				color: #fff;
				white-space: nowrap;
				text-align: center;
				font-size: 14px;
				border: none;
				border-radius: 2px;
				cursor: pointer;
				margin-left: 130px;
			}
			
			.icon_false {
				display: inline-block;
				width: 14px;
				height: 2px;
				background: #fff;
				line-height: 0;
				font-size: 0;
				vertical-align: middle;
				-webkit-transform: rotate(45deg);
			}
			
			.icon_false:after {
				content: '/';
				display: block;
				width: 14px;
				height: 2px;
				background: #fff;
				-webkit-transform: rotate(-90deg);
			}
		</style>
		
	</head>
	<body>
		<div id="tj_1_1">
			商品基本信息
		</div>
		<div id="tj_1_2">
			<div class="div1_1" style="margin-left: 1px;height: 38px;margin-bottom: 15px;">
				品牌名称：<input id="name" type="text" class="input1" value="" placeholder="" style="margin-left: 17px;" />
			</div>
			<div class="div1_1" style="height: 241px;margin-bottom: 51px;">品牌LOGO：
				<div id="uploader" class="wu-example" style="width: 500px;height: 118px;border: 1px dashed rgb(23,23,23);margin: auto">
					<!--用来存放文件信息-->
					<div id="thelist" class="uploader-list"></div>
					<div class="btns">
						<div id="picker">选择文件</div>
					</div>
				</div>
				<div id="img"></div>
			</div>
			<div class="div1_1" style="height: 38px;margin-bottom: 15px;">供应商：
				<input id="supplier" type="text" class="input1" value="" placeholder="" style="margin-left: -6px;" />
			</div>
			<div class="div1_1" style="height: 38px;margin-bottom: 15px;">描述：
				<textarea id="describe" rows="10" cols="50">
					
				</textarea>
			</div>
		</div>
		<div id="tj_1_3">
			<button id="tjbtn">确认</button>
		</div>
		<script type="text/javascript">
			var uid;
			var uploader = WebUploader.create({
			            swf: '/static/webuploader/Uploader.swf',
			            server: '/webuploader.php',
			            pick: '#picker',//指名那个内容是上传按钮
			            resize: false,
			
			            // 选完文件后，是否自动上传。
			            auto:true,
			
			            //指定接受哪些类型的文件。
			            /*accept :{
			                    title: 'Images',
			                        extensions: 'gif,jpg,jpeg,bmp,png',
			                    mimeTypes: 'image/!*'
			                },*/
			            //指定Drag And Drop拖拽的容器，如果不指定，则不启动。(参数id)
			            dnd:'#uploader',
			
			            //是否禁掉整个页面的拖拽功能，如果不禁用，图片拖进来的时候会默认被浏览器打开。
			            disableGlobalDnd:true,
			
			            //是否要分片处理大文件上传。
			            //chunked:true,
			        });
					uploader.on( 'uploadSuccess', function( file,msg ) {
						console.log('----上传成功-----');
						console.log('/tmp/'+file.name);
						tp = 'tmp/'+file.name;
						//console.log(msg._raw);
						//console.log(msg);
						/* $.ajax({
							url:"/webuploader.php",
							type:'post',
							data:{
								act:1,
								name:file.name
							},
							success:function (msg) {
								console.log(msg);
							}
						}) */
					});
					uploader.on( 'fileQueued', function( file ) {
			
						//第一个为error，如果生成缩略图有错误，此error将为真。
						//第二个为ret, 缩略图的Data URL值。
						uploader.makeThumb( file, function( error, ret ) {
							if ( error ) {
								console.log('不是图片');
							} else {
								$("#img").html('<img src="'+ret+'"/>');
							}
						});
					});
					$(document).ready(function(){
						uid=sessionStorage.getItem("uid");
						var name=sessionStorage.getItem("name");
						var logo=sessionStorage.getItem("logo");
						var describe=sessionStorage.getItem("describe");
						var supplier=sessionStorage.getItem("supplier");
						$('#name').val(name);
						$('#supplier').val(supplier);
						$('#describe').val(describe);
						tp=logo;
						$("#img").append('<img style="width: 110px;height: 110px;" src="'+tp+'"/>');
					});
					$("#tjbtn").click(function() {
						$.ajax({
							type:'post',
							url:'/pinpaiupdate.php',
							data:{
								uid:uid,
								name:$('#name').val(),
								logo:tp,
								describe:$('#describe').val(),
								supplier:$('#supplier').val()
							},
							dataType:'json',
							success:function(mgs){
								window.location.href="/pinpai.html";
							}
						});	
					});
		</script>
	</body>
</html>
